package com.huzz.util.desin.memento;

// 创建原发器类
class Originator {
    private String state;

    public void setState(String state) {
        this.state = state;
    }

    public Memento saveStateToMemento() {
        return new Memento(state);
    }

    public void restoreStateFromMemento(Memento memento) {
        state = memento.getState();
    }

    public void printState() {
        System.out.println("当前状态：" + state);
    }
}